<template>
  <view id="appointmentSuccess">
    <view>
      <image
        class="center-image"
        :src="`${imageBaseUrl}/appointment/image/appointment_success.png`"
      ></image>
    </view>
    <view class="appoint-success-view">
      <text class="appoint-success-text">预约成功！</text>
    </view>
    <view class="time-view">
      <text class="current-time-text">{{ currentTime }}</text>
    </view>
    <view class="time-view">
      <text class="arrive-time-text">请于{{ arriveTime }}到店</text>
    </view>
    <view class="tip-text-view">
      关注"建业车生活"公众号，可以收到服务时间提醒信息
    </view>
    <view class="look-appoint-order-view" @tap="goAppointDetail">
      查看预约单
    </view>
    <view class="back-to-index-view" @tap="goHome"> 返回首页 </view>
  </view>
</template>
<script>
import Taro from "@tarojs/taro";
import "./appointmentSuccess.less";
import { formatTime } from "../../../common.js";
import bulterApi from "@souche2014/bulter-api";
const api = bulterApi({ partner: "IOParking" });
export default {
  name: "appointmentSuccess",
  data() {
    return {
      apiBaseUrl: process.env.IOParking.API_HOST, //请求头部
      imageBaseUrl: process.env.IOParking.IMAGE_BASE,
      currentTime: formatTime(new Date(), "Y-M-D h:m"),
      arriveTime: "",
      orderId: "",
    };
  },
  //mixins:[authorize],
  components: {},
  mounted() {},

  onLoad: function (options) {
    console.log("参数:", JSON.stringify(options));
    if (options) {
      this.orderId = options.orderId;
      let date = options.date;
      let time = options.time;
      this.arriveTime = `${date} ${time}`;
    }
  },
  created() {
    this.$instance = Taro.getCurrentInstance();
  },
  methods: {
    //回到主页
    goHome() {
      api.openPage("home");
    },
    //进入预约单详情
    goAppointDetail() {
      Taro.redirectTo({
        url: `../appointmentDetail/appointmentDetail?id=${this.orderId}`,
      });
    },
    //end
  },
};
</script>

